<template>
    <fieldset>
        <legend>产品列表</legend>
        <ul>
            <li v-for="item in list" :key="item._id">
                <router-link :to="{ path: `/detail/${item.productId}` }">
                    {{ item.productName }}
                </router-link>
            </li>
        </ul>
    </fieldset>
</template>
<script>
//1.请求列表数据 http://chst.vip:1234/api/getmoneyctrl

//2.渲染列表数据

//3.点击列表数据进行跳转,并且携带产品id

export default {
    data() {
        return {
            list: []
        }
    },
    mounted() {
        fetch("http://chst.vip:1234/api/getmoneyctrl")
            .then(body => body.json())
            .then(res => {
                console.log(res)
                this.list = res.result;
            })
    }
}
</script>